package com.lh.bootswagger.entity;

import lombok.Data;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;
import java.io.Serializable;


/**
 * 系统申请密钥表
 */
@Data
@Entity
@Table(name = "t_apply_key", schema = "k12")
public class ApplyKey implements Serializable {

	/**
	 *
	 */
	private static final long serialVersionUID = -7350770214710055898L;

	/**
	 * null
	 * default value: null
	 */
	@Id
	@Column(name = "id", nullable = false, length = 20)
	private Long id;

	/**
	 * appid
	 * default value: null
	 */
	@Column(name = "appid")
	private String appId;

	/**
	 * access_token
	 * default value: null
	 */
	@Column(name = "access_token")
	private String accessToken;

	/**
	 * 公钥
	 * default value: null
	 */
	@Column(name = "private_key")
	private String privateKey;

	/**
	 * 私钥
	 * default value: null
	 */
	@Column(name = "public_key")
	private String publicKey;

	/**
	 * 公钥
	 */
	@Column(name = "net_public_key")
	private String netPublicKey;

	/**
	 * 私钥
	 */
	@Column(name = "net_private_key")
	private String netPrivateKey;

	/**
	 * 客户端公钥
	 */
	@Column(name = "client_public_key")
	private String clientPublicKey;

	/**
	 * 客户端私钥
	 */
	@Column(name = "client_private_key")
	private String clientPrivateKey;

	/**
	 * 对称秘钥
	 */
	@Column(name = "des_key")
	private String desKey;

	/**
	 * 系统申请基本信息id
	 * default value: null
	 */
	@OneToOne(optional = false)
	@JoinColumn(name = "APPLY_INFO_ID", referencedColumnName = "ID")
	@NotFound(action = NotFoundAction.IGNORE)
	private ApplyInfo applyInfo;

	public ApplyKey() {
	}

	public ApplyKey(String appId) {
		this.appId = appId;
	}
}
